<template>
    <div>
      <div class="banner"  @click="handleClickImg">
        <swiper :options="swiperOption">
          <swiper-slide v-for="(item,index) of swiper" :key="index">
            <img class="banner-img" :src="item">
            <div class="banner-info">
              <div class="banner-title">
                {{sightName}}
              </div>
              <div class="banner-number">
                <span class="iconfont arrow-icon">&#xe650;</span>
                {{index+1}}
              </div>
            </div>
          </swiper-slide>
          <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
      </div>
      <common-gallary v-show="hasClick" @close="handleClickImg"></common-gallary>
    </div>
</template>

<script>
import 'swiper/dist/css/swiper.css'
import CommonGallary from 'common/gallary/Gallary.vue'
export default {
  name: 'Detail-Banner',
  props: {
    swiper: Array,
    sightName: String
  },
  components: {
    CommonGallary
  },
  data () {
    return {
      hasClick: false,
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true
      }
    }
  },
  methods: {
    handleClickImg () {
      this.hasClick = !this.hasClick
    }
  }
}
</script>

<style lang="stylus" scoped>
.banner >>> .swiper-pagination-bullet-active
  background :white
.banner
  overflow: hidden
  height: 0
  padding-bottom: 65%
  .banner-img
    width: 100%
    height: 100%
  .banner-info
    display flex
    position absolute
    left: 0
    right: 0
    bottom: 0
    line-height: .3rem
    .banner-title
     flex: 1
     color: black
    .banner-number
      padding: 0 .1rem
      height: .1rem
      lint-height: .1rem
</style>
